﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using RimWorld;
using Verse;

namespace Miao
{

    [HarmonyPatch(typeof(Storyteller), "InitializeStorytellerComps")]
    public class Storyteller_InitializeStorytellerComps_Postfix
    {
        static void Postfix()
        {
            if(Current.Game.storyteller.def == null)
            {
                return;
            }
            if (Current.Game.storyteller.def.defName != "KazeAndJUENightTwins")
            {
                //清空一下天气效果
                foreach (var map in Find.Maps)
                {
                    for (int a = 0; a < map.gameConditionManager.ActiveConditions.Count; a++)
                    {
                        if (map.gameConditionManager.ActiveConditions[a].def == GameConditionDefOf.TemperatureDrop)
                        {
                            map.gameConditionManager.ActiveConditions[a].End();
                        }
                    }
                }
                //Messages.Message("清空天气", MessageTypeDefOf.NeutralEvent);
            }
            //Messages.Message("故事者进入", MessageTypeDefOf.NeutralEvent);
            //Log.Message("故事者进入调试堆栈");
            //StackTrace stackTrace = new StackTrace();

                //for(int i=0;i< stackTrace.FrameCount;i++)
                //{
                //    Log.Message(stackTrace.GetFrames()[i].ToString());
                //}
        }
    }
}
